<style type="text/css">
#ar{
    position:absolute;
    top:5px;
    right:0px;
    border:6px inset #b0b5bd;
    text-align:center;
    color:#000066;
    background-color:#d0d6df;
    cursor:move;
    height:50px;
    width:340px;
}
</style>
<div id="ar"></div>
<br><br>
<?php echo CYui::init(true, true); $ajax = CYui::buildAjaxOptions('/widget/ajaxcall', 'ar'); ?>
<h2>Autocomplete Demo</h2>
<br><br>
<div class="yiiForm" align="center">
    <?php echo CHtml::beginForm(); ?>
    <div style="width:70%" align="left">
        Type "A" or "B" or "C"<br><br>
        <?php echo CYui::autocompleteTable($id, $value, $tableName, $fieldName, $ajax); ?>
    </div>
    <br><br>
    <div class="action">
        <?php echo CHtml::submitButton('Post'); ?>
    </div>
    <?php echo CHtml::endForm(); ?>
</div><!-- yiiForm -->
<br><br>
<table class="dataGrid">
    <tr>
        <th colspan="4"><h3>activeAutocomplete</h3></th>
    </tr>
    <tr>
        <th>Param</th>
        <th>Type</th>
        <th>Description</th>
        <th>Required / default</th>
    </tr>
    <tr>
        <td><b>$model</b></td>
        <td>CModel</td>
        <td>data model</td>
        <td align="center">+</td>
    </tr>
    <tr>
        <td><b>$attribute</b></td>
        <td>string</td>
        <td>attribute</td>
        <td align="center">+</td>
    </tr>
    <tr>
        <td><b>$responseUrl</b></td>
        <td>string</td>
        <td>controller/action for response</td>
        <td align="center">+</td>
    </tr>
    <tr>
        <td><b>$responseFieldName</b></td>
        <td>string</td>
        <td>field name for autocomplete widget in result array</td>
        <td align="center">+</td>
    </tr>
    <tr>
        <td><b>$ajax</b></td>
        <td>array</td>
        <td>ajax call when select new value for widget</td>
        <td align="center">NULL</td>
    </tr>
    <tr>
        <td><b>$options</b></td>
        <td>array</td>
        <td><?php echo CHtml::link('full options list on Yahoo! UI Library', 'http://developer.yahoo.com/yui/autocomplete/#configs'); ?></td>
        <td align="center">-</td>
    </tr>    
    <tr>
        <td colspan="4" align="center">
            <?php echo CYui::codeHighlight(' echo CYui::activeAutocomplete(`Comment`, `postTitle`, `post/list/query/`, `title`);', 'php'); ?>
        </td>
    </tr>
</table>
<br>
<table class="dataGrid">
    <tr>
        <th colspan="4"><h3>activeAutocompleteTable</h3></th>
    </tr>
    <tr>
        <th>Param</th>
        <th>Type</th>
        <th>Description</th>
        <th>Required / default</th>
    </tr>
    <tr>
        <td><b>$model</b></td>
        <td>CModel</td>
        <td>data model</td>
        <td align="center">+</td>
    </tr>
    <tr>
        <td><b>$attribute</b></td>
        <td>string</td>
        <td>attribute</td>
        <td align="center">+</td>
    </tr>
    <tr>
        <td><b>$tableName</b></td>
        <td>string</td>
        <td>table name</td>
        <td align="center">+</td>
    </tr>
    <tr>
        <td><b>$fieldName</b></td>
        <td>string</td>
        <td>autocomplete field name</td>
        <td align="center">+</td>
    </tr>
    <tr>
        <td><b>$ajax</b></td>
        <td>array</td>
        <td>ajax call when select new value for widget</td>
        <td align="center">NULL</td>
    </tr>
    <tr>
        <td><b>$options</b></td>
        <td>array</td>
        <td><?php echo CHtml::link('full options list on Yahoo! UI Library', 'http://developer.yahoo.com/yui/autocomplete/#configs'); ?></td>
        <td align="center">-</td>
    </tr>
    <tr>
        <td colspan="4" align="center">
            <?php echo CYui::codeHighlight(' echo CYui::activeAutocompleteTable(`User`, `group`, `Group`,`name`);', 'php'); ?>
        </td>
    </tr>
</table>